package cn.flaty.views.web.users;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.flaty.views.web.BaseController;
import cn.flaty.views.web.JsonBaseWrapper;
import cn.flaty.views.web.interceptors.AddToken;
import cn.flaty.views.web.interceptors.CheckToken;


@Controller
@RequestMapping("/token")
public class TokenController extends BaseController {

	@AddToken
	@RequestMapping(value="/show",method = RequestMethod.GET)
	public String tokenPage() {
		return "/views/users/token";
	}
	
	@RequestMapping(method = RequestMethod.POST)
	@CheckToken
	public String token(Model model) {
		System.out.println("==token==");
		JsonBaseWrapper jbw = new JsonBaseWrapper();
		jbw.setSuccess(true);
		model.addAttribute(jbw);
		return "/views/users/tokenSuccess";
	}

	
}
